﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.anhry.app.safety.util.Util"/>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>企业添加</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/check_jquery.js"></script>
	<script type="text/javascript" src="<%=path%>/js/selected.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/dbdialog/lhgdialog.min.js<%=Util.LHGDIALOG%>"></script>
	<script type="text/javascript" src="<%=path%>/js/util.js"></script>
	<script type="text/javascript">
		var boolUserName=false;	//用户名是否重复
		function corpCheck(){
    		var userName = encodeURI(encodeURI($("#corpName").val()));
    		if(userName==""){
	         $("#labelUser").html("企业名称不能为空!").addClass("note5");
	         return;
	        }
			$.ajax({
				type:"POST",
				async: true,      //ajax同步
				url:"<%=basePath%>/enterprise/corp_corpCheck.action?corpName="+userName,
				success:function(data){
					if(data=="0"){
						boolUserName=false;
						$("#labelUser").html("<font color='green'>此企业名称可以使用！</font>");
						return;
					}else if(data=="1"){
						boolUserName=true;
						$("#labelUser").html("该企业系统中已经存在!").addClass("note5");
						return;
					}
				}
			});
    	}
    	
    	function doSelect(obj1,obj2){
				var temArry = obj1.split('_');
				if(temArry[1]==1){//无
					$("#"+obj2).val('');
					$("#"+obj2).attr("disabled",true);
				}else{
					$("#"+obj2).attr("disabled",false);
				}
		}
    	
    	function judge(nam){
		 	var cos =/^[+\-]?\d+(.\d+)?$/;
			v=nam.value;
		 	if(cos.exec(v)==null){
				nam.value ="";
				var vid=$("#"+nam);
		    	vid.next(".note4").html("请输入数字").addClass("note5");
				vid.focus();
			}    
		    sumNum();
		}
		function roundTmp(x,y){
			var _pow=Math.pow(10,y);
			x*=_pow;
		 	x=Math.round(x);
		 	return x/_pow;
		}
		function sumNum(){
	 		var else1 = isNaN(parseFloat(document.getElementById('bnumber1').value,10))?0:parseFloat(document.getElementById('bnumber1').value,10);
		 	var else2 = isNaN(parseFloat(document.getElementById('bnumber2').value,10))?0:parseFloat(document.getElementById('bnumber2').value,10);
		 	sumelse=parseFloat(else1)+parseFloat(else2); 
		 	sumelse=roundTmp(sumelse,4);
	     	document.getElementById('totalarea').innerHTML=sumelse;
		}
		
		function fnCheck(){
    		if(boolUserName){
    			$("#corpName").focus();
    			$("#labelUser").html("该企业系统中已经存在!").addClass("note5");
    			return false;
    		}
    		return true;
   		 }
    	
    	$(function(){
			initSelArray('unitId:1','deptId:1','minTypeId:2');
		});
       	function changeCounty(cid){
	   		var urls='<%=basePath%>/util/data_getDept.action?cUnit='+cid+"&cCounty=1";
	   		buildSelect(cid, 'unitId',urls,'1');
	   	}
	   	function changeUnit(uid){
	   		var urls="<%=basePath%>/util/data_getDept.action?cUnit="+uid;
	   		buildSelect(uid, 'deptId',urls,'1');
	   	}
	   	function changeType(maxid){
	   		var urls="<%=basePath%>/util/data_getCorpType.action?cMaxType="+maxid;
	   		buildSelect(maxid, 'minTypeId',urls,'2');
	   	}
	   	
	   	function opdlg(){
			infoDialog('corpSize','选择一级企业','800','320','<%=path%>/enterprise/con_corpList.action?forward=5');
		}
	</script>
  </head>
  
  <body>
	<div  class="body-box">
		<div class="map">
			<div class="map_con">
				您当前的位置：企业分类管理 &gt; 二级企业管理 &gt; 企业添加
			</div>
			
		</div>
		<div id="container">
			<form action="<%=basePath%>/enterprise/two_saveOrUpdate.action" method="post" name="form1">
		    	<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td colspan="4" class="title_li">企业添加</td>
					</tr>
					<tr>
						<td width="15%" class="title_td">选择一级企业：</td>
						<td colspan="3">
							<input type="text" name="corpSjName" size="70%" value="" id="corpSjName" readonly="readonly"/><label class="note4">*</label>&nbsp;<a href="javascript:opdlg();">选择一级企业</a>
						</td>
					</tr>
					<tr>
						<td width="15%" class="title_td">企业名称：</td>
						<td colspan="3">
							<input type="text" name="corpName" size="70%" value="" id="corpName" onblur="corpCheck()"/><label class="note4" id="labelUser">*</label>
							<a href="javascript:corpCheck();">检测企业名称是否可用</a>&nbsp;&nbsp;（4-32个字符）
						</td>
					</tr>
					<tr>
						<td width="15%" class="title_td">经营地址：</td>
						<td colspan="3"><input type="text" name="corpOfficeAddress" size="70%" value=""/></td>
					</tr>
					<tr>
						<td width="15%" class="title_td">属地：</td>
						<td colspan="3">
							<s:select list="sdList" name="countyId" listKey="id" listValue="deptName" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect1" onchange="changeCounty(this.value);"></s:select><SPAN class="note4">*</SPAN>
				   			<s:select list="#{}" name="unitId" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="select2" onchange="changeUnit(this.value);"></s:select>
				   			<s:select list="#{}" name="deptId" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="select3"></s:select>
						</td>
					</tr>
					<tr>
						<td width="15%" class="title_td">企业类型：</td>
						<td colspan="3">
							<s:select list="typeList" name="maxTypeId" listKey="id" listValue="typeName" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect4" onchange="changeType(this.value);"></s:select> <SPAN class="note4">*</SPAN>
				   			<s:select list="#{}" name="minTypeId" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;" id="bselect5"></s:select><SPAN class="note4">*</SPAN>
						</td>
					</tr>	
					<tr>
						<td class="title_td">职业病危害：</td>
						<td>
						<input type="radio" onclick="doSelect('corpIsZyb_1','corpZyb');" checked="checked" name="corpIsZyb" value="0">无
						<input type="radio" onclick="doSelect('corpIsZyb_2','corpZyb');" name="corpIsZyb" value="1">有
						</td>
						<td class="title_td">职业病危害因素：</td>
						<td><input name="corpZyb" id="corpZyb" type="text" class="info_input1" value="${corp.corpZyb}" disabled="disabled"></td>
					</tr>
					<tr>
					    <td class="title_td">特种设备：</td>
					    <td>
						<input type="radio" onclick="doSelect('corpIsTeshe_1','corpTeshe');" checked="checked" name="corpIsTeshe" value="0">无
						<input type="radio" onclick="doSelect('corpIsTeshe_2','corpTeshe');"  name="corpIsTeshe" value="1">有
						</td>
						<td class="title_td">特种设备名称：</td>
						<td><input name="corpTeshe" id="corpTeshe" type="text" class="info_input1" value="${corp.corpTeshe}" disabled="disabled"></td>
					</tr>
					<tr>
						<td class="title_td">涉及危化使用：</td>
						<td>
						<input type="radio" onclick="doSelect('corpIsShewei_1','corpShewei');" checked="checked"name="corpIsShewei" value="0">无
						<input type="radio" onclick="doSelect('corpIsShewei_2','corpShewei');" name="corpIsShewei" value="1">有
						</td>
						<td class="title_td">涉及危化名称：</td>
						<td><input name="corpShewei" id="corpShewei" type="text" class="info_input1" value="${corp.corpShewei}" disabled="disabled"></td>
					</tr>
					<tr>
					    <td class="title_td">重大危险源：</td>
					    <td>
						<input type="radio" onclick="doSelect('corpIsDanger_1','corpDanger');" checked="checked" name="corpIsDanger" value="0">无
						<input type="radio" onclick="doSelect('corpIsDanger_2','corpDanger');" name="corpIsDanger" value="1">有
						</td>
						<td class="title_td">重大危险源名称：</td>
						<td><input name="corpDanger" id="corpDanger" type="text" class="info_input1" value="${corp.corpDanger}" disabled="disabled"></td>
					</tr>			
					<tr>
						<td class="title_td">避雷装置：</td>
						<td><s:radio list="#{0:'无',1:'有'}" value="0" name="corpIsBlzh" theme="simple"></s:radio></td>
						<td class="title_td">是否小微企业：</td>
						<td><s:radio list="#{'1':'非小微企业','2':'小微企业'}" name="corpReportType" theme="simple" value="1"></s:radio></td>
					</tr>
					<tr>
						<td class="title_td">企业状态：</td>
						<td colspan=3><s:select list="#{'运营':'运营','基建期':'基建期','停业':'停业','停产':'停产','关闭':'关闭'}" name="corpStatus" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;"></s:select></td>
					</tr>								
				</table>
				<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td colspan="8" class="title_li">人员信息</td>
					</tr>
					<tr>
						<td width="8%" class="title_td">主要负责人：</td>
						<td width="17%"><input type="text" name="corpFzr" class="info_input" value="" id="bitfzr1"/><SPAN class="note4">*</SPAN></td>
						<td width="7%" class="title_td">性别：</td>
						<td width="18%"><s:radio list="#{0:'女',1:'男'}" value="0" name="corpFzrSex" theme="simple"></s:radio><SPAN class="note4">*</SPAN></td>
						<td width="7%" class="title_td">电话：</td>
						<td width="18%"><input type="text" name="corpFzrPhone" class="info_input" value="" id="btel29"/><SPAN class="note4">*</SPAN></td>
						<td width="7%" class="title_td">手机：</td>
						<td width="18%"><input type="text" name="corpFzrMobile" class="info_input" value="" id="btel243"/><SPAN class="note4">*</SPAN></td>
					</tr>
					<tr>
					    <td width="8%" class="title_td">邮箱：</td>
						<td width="17%"><input name="corpFzrEmeail" type="text" class="info_input" value="" id="email"><span class="note4"></span></td>
						<td width="8%" class="title_td">学历</td>
						<td width="17%"><s:select list="#{'1':'小学','2':'初中','3':'高中','4':'本科','5':'研究生','6':'博士'}" name="corpFzrDegree" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;"></s:select></td>
						<td width="7%" class="title_td">培训情况：</td>
						<td width="18%"><input type="text" name="corpFzrTraining" class="info_input" value=""/></td>
						<td width="7%" class="title_td">工作年限：</td>
						<td width="18%"><input type="text" name="corpFzrWorkingYear" class="info_input" value=""/>年</td>
					</tr>
					<tr>
						<td width="8%" class="title_td">安全负责人：</td>
						<td width="17%"><input type="text" name="corpAqfzr" class="info_input" value="" id="bitaqr1"/><SPAN class="note4">*</SPAN></td>
						<td width="7%" class="title_td">性别：</td>
						<td width="18%"><s:radio list="#{0:'女',1:'男'}" value="0" name="corpAqfzrSex" theme="simple"></s:radio><SPAN class="note4">*</SPAN></td>
						<td width="7%" class="title_td">电话：</td>
						<td width="18%"><input type="text" name="corpAqfzrPhone" class="info_input" value="" id="btel27"/><SPAN class="note4">*</SPAN></td>
						<td width="7%" class="title_td">手机：</td>
						<td width="18%"><input type="text" name="corpAqfzrMobile" class="info_input" value="" id="btel28"/><SPAN class="note4">*</SPAN></td>
					</tr>
					<tr>
					    <td width="8%" class="title_td">邮箱：</td>
						<td width="17%"><input name="corpAqfzrEmeail" type="text" class="info_input" value="" id="email1"><span class="note4"></span></td>
						<td width="8%" class="title_td">学历</td>
						<td width="17%"><s:select list="#{'1':'小学','2':'初中','3':'高中','4':'本科','5':'研究生','6':'博士'}" name="corpAqfzrDegree" headerKey="" headerValue="请选择" theme="simple" cssStyle="width:155px;margin-left:5px;"></s:select></td>
						<td width="7%" class="title_td">培训情况：</td>
						<td width="18%"><input type="text" name="corpAqfzrTraining" class="info_input" value=""/></td>
						<td width="7%" class="title_td">工作年限：</td>
						<td width="18%"><input type="text" name="corpAqfzrWorkingYear" class="info_input" value=""/>年</td>
					</tr>
				</table>
				<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td align="center">
							<center>
							<input type="submit" name="btntj" class="link_input" id="btnSubmit1" value="提 交" onclick="return fnCheck();">
							<input type="reset" name="btnset" class="link_input" id="btnset" value="重 置">
							<input type="button" name="btn1" class="link_input" id="btnset1" value="返 回" onclick="window.location.href='<%=basePath%>/enterprise/two_list.action'">
							</center>
						</td>
					</tr>
				</table>
				<input type="hidden" name="corpSjId" id="corpSjId" value="">
			</form>
		</div>
	</div>
  </body>
</html>
